// The command package contains the individual commands within Microtool.
package command

type Command struct {
	// Name identifies the command for the --command flag.
	Name string

	// Info is a brief human-readable description of the command.
	Info string

	// Fn is the actual implementation of the command.
	Fn CommandFn
}

// CommandFn is the type of a command implementation.  Each of these
// implementations should be brief and dispatch to library packages as much as
// possible.
type CommandFn func(input, dialect string) error

// The Active map holds all currently available commands.
//
// TODO: The initial release version should extend this mechanism to provide
// limited visibility of commands that are experimental or under active
// development.
var Active map[string]*Command

func init() {
	Active = map[string]*Command{
		list.Name:         list,
		listDialects.Name: listDialects,
		reformat.Name:     reformat,
	}
}
